<%@ page language="java"  pageEncoding="utf-8"%>
<%@ page import="com.ejoysoft.wlanyz.business.Ac,java.util.ArrayList,com.ejoysoft.common.Constants,com.ejoysoft.common.exception.NoRightException" %>
<%@page import="java.util.Vector"%>
<%@ include file="../include/jsp/head.jsp"%>
<%
if(!globa.userSession.hasRight("40005"))
      throw new NoRightException("用户不具备操作该功能模块的权限，请与系统管理员联系！");
%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String  strParaName=ParamUtil.getString(request,"strParaName","");//获取参数名
ArrayList<String>  paranames = new ArrayList<String>();
String paraname1= "射        线         条        数";
paranames.add(paraname1);
String paraname2="渲     染     方     格     数";
paranames.add(paraname2);
String paraname3="非可视区域最大区间";
paranames.add(paraname3);
String paraname4="信   号   衰   减   阈   值";
paranames.add(paraname4);
String explain = "";
String explain1 = "请输入180的整数倍！";
String explain2 = "请输入某个整数的平方！";
String explain4 = "请输入一个数字！";
String name1 = "rays";
String name2 = "cells";
String name3 = "invisible";
String name4 = "attenuation";
%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
  <head>
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script src="../scripts/jsframework.js"></script>
<script src="../scripts/jquery-1.4.1.min.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><style type="text/css">

<!--
body {
	background-color: #f2f8ff;
}
.sel1{ width:160px;}
.STYLE1 {color: #FF0000}
a:link{ line-height:25px;height:25px; color:#2074b8;text-decoration:none}
a:hover{ line-height:25px;height:25px; color:#333333;text-decoration:none}
-->
</style>
<script src="../include/js/chkFrm.js"></script>
 
<script language="javascript">

    function chkFrm() {
    if(trim(frm.strParaName.value)=="")
    {
            alert("请选择参数名称！！！")
            frm.strParaName.focus();
            return false;
    }
    if(trim(frm.strParaName.value)=='<%=paraname1.trim()%>')
    {
           if(trim(frm.ParaValue.value)=="") {
            alert("请输入射线条数！！！")
            frm.ParaValue.focus();
            return false;
            }
            if(!(trim(frm.ParaValue.value)%180==0)) {
            alert("请输入有效的射线条数！！！")
            frm.ParaValue.focus();
            return false;
            }
            if(trim(frm.ParaValue.value)>2147483647) {
            alert("请输入有效的射线条数！！！")
            frm.ParaValue.focus();
            return false;
            }
            if(Math.floor(trim(frm.ParaValue.value))!=trim(frm.ParaValue.value)) {
            alert("请输入整数！！！")
            frm.ParaValue.focus();
            return false;
            }
            document.getElementById("ParaName").value = '<%=name1%>';
           
    }
    
     if(trim(frm.strParaName.value)=='<%=paraname2.trim()%>')
    {
           if(trim(frm.ParaValue.value)=="") {
            alert("请输入渲染方格数！！！")
            frm.ParaValue.focus();
            return false;
            }
            if(Math.floor(Math.sqrt(frm.ParaValue.value))*Math.floor(Math.sqrt(frm.ParaValue.value))!=frm.ParaValue.value) {
            alert("请输入有效渲染方格数！！！")
            frm.ParaValue.focus();
            return false;
            }
            if(Math.floor(trim(frm.ParaValue.value))!=trim(frm.ParaValue.value)) {
            alert("请输入整数！！！")
            frm.ParaValue.focus();
            return false;
            }
            document.getElementById("ParaName").value = '<%=name2%>';
           
    }
    
      if(trim(frm.strParaName.value)=='<%=paraname3.trim()%>')
    {
           if(trim(frm.ParaValue.value)=="") {
            alert("请输入非可视区域的最大区间！！！")
            frm.ParaValue.focus();
            return false;
            }
            if(Math.floor(trim(frm.ParaValue.value))!=trim(frm.ParaValue.value)) {
            alert("请输入整数！！！")
            frm.ParaValue.focus();
            return false;
            }
            document.getElementById("ParaName").value = '<%=name3%>';
           
    }
    
     if(trim(frm.strParaName.value)=='<%=paraname4.trim()%>')
    {
           if(trim(frm.ParaValue.value)=="") {
            alert("请输入信号衰减阈值！！！")
            frm.ParaValue.focus();
            return false;
            }
            if(isNaN(trim(frm.ParaValue.value))) {
            alert("请输入一个数字！！！")
            frm.ParaValue.focus();
            return false;
            }
          document.getElementById("ParaName").value = '<%=name4%>';
             
    }
    
     	frm.submit();
    }
    function getExplain(paraname)
    {
   
      if(trim(paraname)=='<%=paraname1.trim()%>')document.getElementById("explain").value ='<%=explain1 %>';
      else if(trim(paraname)=='<%=paraname2.trim()%>')document.getElementById("explain").value ='<%=explain2 %>';
      else if(trim(paraname)=='<%=paraname4.trim()%>')document.getElementById("explain").value ='<%=explain4 %>';
      else document.getElementById("explain").value ="";
   
    }
</script>

</head>

<body>
<form name="frm" METHOD=POST ACTION="signalpara_act.jsp" enctype="multipart/form-data">
<input type="hidden" name="<%=Constants.ACTION_TYPE%>" value="<%=Constants.ADD_STR%>">
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><img src="../images/ri_list.jpg" width="14" height="14" align="absbottom" />&nbsp;您现在所在的位置：<font color="#0e7cc9">参数管理</font> &gt; 添加参数 </td>
  </tr>
</table>
<br>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>
    <td width="6%" class="listtit1"  style="border-left:1px solid #32a4ea;">&nbsp;参数添加</td>
  </tr>
  <tr>
    <td bgcolor="#FFFFFF" class="listd" style="border-left:1px solid #dddddd;border-right:1px solid #dddddd;"><table width="702" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td height="20" colspan="4">&nbsp;</td>
      </tr>
      <tr>
        <td width="128" align="right">&nbsp;</td>
        <td width="100"  align="right" class="tdwz">参数名：</td>
        <td width="262"><select id="strParaName" name="strParaName"  class="sel1" style="width:150px"  onchange="getExplain(this.value)">
		    <option value="">   = =请选择= =</option>
			  <% for (int j = 0; j <  paranames.size(); j++) {
					String paraname = paranames.get(j);
					String selected = "";
					if(strParaName!= null && strParaName.equals(paraname))
						selected = "selected='selected'";
				%>
				<option value="<%=paraname%>" <%=selected%>>
					<%=paraname%>
				</option>
				<%
				}
				%>
		</select> </td>
        <td width="212">&nbsp;</td>
      </tr>
      <tr>
        <td align="right">&nbsp;</td>
        <td align="right" class="tdwz">参数值：</td>
        <td><input id="ParaValue" name="ParaValue" type="text" value="" class="ipt"/></td><td><input id = "explain" name = "explain"  value="" align="middle" readonly="readonly" style="border:0;color:red"class="css"size="30"/></td>
        <td>&nbsp;<input id="ParaName"name="ParaName" type="hidden" value=""/></td>
      </tr>
      <tr>
        <td align="right">&nbsp;</td>
        <td height="50" align="left">&nbsp;&nbsp;</td>
        <td height="50" colspan="2" align="left"><input name="B1" type="button"  value="确  定" onclick="chkFrm()" class="ipt1" style="cursor:hand"/>
          &nbsp;<input  name="B12" type="reset" value="取 消" class="ipt2" style="cursor:hand"/>
          </td>
        </tr>
    </table>
      <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p></td>
  </tr>
</table>
<p><br />
</p>
    </form>
 	<table id="testTable" width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr> <td>
	<script language="javascript">
	  // document.write(a.render());
	 //  a.expandLevel(1);
	</script>
	</td></tr></table>
</body>
</html>

